package com.youmingxing.view;

import android.text.Editable;
import android.text.TextWatcher;

/**
 * @author evilyin(ChenZhixi)
 * @since 15/10/31
 */
public abstract class TextCountWatcher implements TextWatcher {
    private int count;

    public TextCountWatcher(int count) {
        this.count = count;
    }
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        if (s.length() >= count) {
            onTextMatchCount();
        }else if (s.length() < count) {
            onTextLessThanCount();
        }
    }

    public abstract void onTextMatchCount();

    public abstract void onTextLessThanCount();
}
